﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Utils;

public partial class ajax_misc : BasePage
{
    // Methods
    protected override void OnLoad(EventArgs e)
    {
        base.OnLoad(e);
        string str = Helper.GetString(base.Request["action"], string.Empty);
        int @int = Helper.GetInt(base.Request["id"], 0);
        string str2 = Helper.GetString(base.Request["v"], string.Empty);
        if (base.GetCookie("admin") == string.Empty)
        {
            base.Response.Write(WebSiteHelper.GetJson("您还没有登录或登录超时，请重新登录！", "alert"));
        }
        else
        {
            string str3;
            if ("sms" == str)
            {
                str3 = WebSiteHelper.LoadPageString("~/ajaxpage/manage_ajax_dialog_miscsms.aspx?v=" + str2);
                base.Response.Write(WebSiteHelper.GetJson(str3, "dialog"));
            }
            else if ("smssend" == str)
            {
                string item = str2;
                string content = base.Request["content"];
                List<string> mobiles = new List<string>();
                mobiles.Add(item);
                if (base.SendSMS(mobiles, content))
                {
                    base.Response.Write(WebSiteHelper.GetJson("call_succ()", "eval"));
                }
                else
                {
                    base.Response.Write(WebSiteHelper.GetJson("call_fail('短信发送失败')", "eval"));
                }
            }
            else if ("link" == str)
            {
                if (!base.CheckUserAuth("help"))
                {
                    base.Response.Write(WebSiteHelper.GetJson("您不具备客服管理员权限", "alert"));
                }
                else if (@int > 0)
                {
                    str3 = WebSiteHelper.LoadPageString("~/webpage/ajaxPage/YouqingLianjie.aspx?id=" + @int);
                    base.Response.Write(WebSiteHelper.GetJson(str3, "dialog"));
                }
                else
                {
                    str3 = WebSiteHelper.LoadPageString("~/webpage/ajaxPage/YouqingLianjie.aspx");
                    base.Response.Write(WebSiteHelper.GetJson(str3, "dialog"));
                }
            }
        }
    }

}